Fix internal jobs beeing shown as deleted

Show more information about previosly labeled "(internal)" jobs that are now available due to the switch to ActiveJob.

Fixes #1460

Dominik Sander 8 years ago
parent
commit
f1ecae6deb
2 changed files with 12 additions and 2 deletions
  1. 9 1
      app/helpers/jobs_helper.rb
  2. 3 1
      app/views/jobs/index.html.erb

+ 9 - 1
app/helpers/jobs_helper.rb

@@ -24,8 +24,16 @@ module JobsHelper
24 24
   #
25 25
   # Can return nil, or an instance of Agent.
26 26
   def agent_from_job(job)
27
-    if data = YAML.load(job.handler.to_s).try(:job_data)
27
+    data = YAML.load(job.handler.to_s).try(:job_data)
28
+    case data['job_class']
29
+    when 'AgentCheckJob', 'AgentReceiveJob'
28 30
       Agent.find_by_id(data['arguments'][0])
31
+    when 'AgentRunScheduleJob'
32
+      "Run Agent schedule '#{data['arguments'][0]}'"
33
+    when 'AgentCleanupExpiredJob'
34
+      'Run Event cleanup'
35
+    when 'AgentPropagateJob'
36
+      'Run Event propagation'
29 37
     else
30 38
       false
31 39
     end

+ 3 - 1
app/views/jobs/index.html.erb

@@ -11,7 +11,7 @@
11 11
         <table class='table table-striped events'>
12 12
           <tr>
13 13
             <th>Status</th>
14
-            <th>Agent</th>
14
+            <th>Agent / Job</th>
15 15
             <th>Created</th>
16 16
             <th>Next Run</th>
17 17
             <th>Attempts</th>
@@ -25,6 +25,8 @@
25 25
             <td><% case agent = agent_from_job(job)
26 26
                    when Agent
27 27
                    %><%= link_to(agent.name, agent_path(agent)) %><%
28
+                   when String
29
+                   %><%= agent %><%
28 30
                    when false
29 31
                    %>(system)<%
30 32
                    when nil